/**
 * Created by IntelliJ IDEA.
 * User: mike
 * Date: 27-Jun-2009
 * Time: 09:00:24
 * To change this template use File | Settings | File Templates.
 */
package org.mkh.cmd;

import java.lang.reflect.Proxy;

/*
* Creates a dynamic proxy for the  supplied   AbstractCommand.
*  The invocation handler is the superclass of the supplied  AbstractCommand subclass i.e. AbstractCommand
* The effect is that all method calls
* */
public class CommandFactory {


    public static final CommandIF createCommand(final AbstractCommand cmd) {


        CommandIF command = (CommandIF) Proxy.newProxyInstance(AbstractCommand.class.getClassLoader(),
                new Class[]{CommandIF.class}, cmd);
        return command;

    }

    private CommandFactory() {
    }
}
